<script type="text/javascript">
function validate_form() {
    <?php
        if(count($this->language) > 0) :
            foreach($this->language as $value) :
    ?>
    if($('#tabs-<?php echo $value['locale'] ?>').hasClass('ui-tabs-hide') == false) {
        var footer_<?php echo $value['locale'] ?> = $('#footer-<?php echo $value['locale'] ?>').val();
        var email = $('#email').val();
        var countError = 0;
        if(footer_<?php echo $value['locale'] ?> == '') {
            $('#errorFooter-<?php echo $value['locale'] ?>').html('Thông tin website không được để trống');
            return false;
        }
        else {
            if((email.length < 1) || (email.length > 100)) {
                $('#errorEmail').html('Email từ 1-100 kí tự');
                countError++;
            }
            else {
                $('#errorEmail').html('');
            }
            var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
            if(reg.test(email) == false) {
                $('#errorEmail').html('Địa chỉ email không đúng định dạng');
                countError++;
            }
            else {
                $('#errorEmail').html('');
            }
            if(countError > 0) {
                return false;
            }
            else {
                return true;
            }
        }
    }
    <?php
            endforeach;
        endif;
    ?>
};
</script>
    <div class="list_category">
        <ul>
            <li><a href="<?php echo $this->baseUrl('admincp/contact'); ?>">Quản lý liên hệ</a></li>
            <li><a href="<?php echo $this->baseUrl('admincp/webinfo'); ?>">Quản lý website</a></li>
        </ul>
    </div>
</div>

<!-- Begin Content -->
<div class="section">
    <div class="heading_section">
        <span>Thông tin website</span>
    </div>
    
    <div class="content">
    <form action="" method="post" onsubmit="return validate_form()">
        <div id="tabs">
            <ul>
                <?php
                    if(count($this->language) > 0) :
                        foreach($this->language as $value) :
                ?>
                    <li><a href="#tabs-<?php echo $value['locale']; ?>"><?php echo $value['name']; ?></a></li>
                <?php
                        endforeach;
                    endif;
                ?>
            </ul>
        <table class="table">
            <tr>
                <td class="td1"><?php echo $this->formLabel('email','Địa chỉ email'); ?>&nbsp;<span class="error-msg">*</span></td>
                <td class="td2"><?php echo $this->formText('email',$this->email,array('class'=>'input')); ?></td>
                <td class="td3" id="errorEmail"></td>
            </tr>
        </table>
        <?php
            if(count($this->data) > 0) :
                foreach($this->data as $value) :
        ?>
        <div id="tabs-<?php echo $value['locale']; ?>">
            <table class="table">
                <tr>
                    <td class="td1"><?php echo $this->formLabel('footer-'.$value['locale'],'Thông tin'); ?>&nbsp;<span class="error-msg">*</span></td>
                    <td class="td2"><?php echo $this->formTextarea('footer-'.$value['locale'],$value['footer'],array('class'=>'textarea')); ?></td>
                    <td class="td3" id="errorFooter-<?php echo $value['locale']; ?>"></td>
                </tr>
            </table>
        </div>
        <?php
                endforeach;
            endif;
        ?>
        <table class="table">
            <tr>
                <td class="td1">&nbsp;</td>
                <td class="td2">
                    <?php echo $this->formSubmit('submit','Cập nhật',array('class'=>'button')); ?>
                    <?php echo $this->formReset('reset','Nhập lại',array('class'=>'button')); ?>
                </td>
                <td class="td3"></td>
            </tr>
            <tr>
                <td class="td1">&nbsp;</td>
                <td class="td2"><span class="error-msg"><?php echo $this->error; ?></span></td>
                <td class="td3"></td>
            </tr>
        </table>
        </div>
    </form>
    </div>
</div>
<!-- End Content -->